package com.heima.wemedia;

import com.heima.file.service.FileStorageService;
import com.heima.wemedia.WemediaApplication;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest(classes = WemediaApplication.class)
@RunWith(SpringRunner.class)
public class OssDemo {
    @Autowired
    FileStorageService fileStorageService;

    @Value("${file.oss.prefix}")
    String prefix;

    @Value("${file.oss.web-site}")
    String webSite;
    @Test
    public void uploadPic() throws FileNotFoundException {
     /*   FileInputStream fileInputStream = new FileInputStream("E:\\CloudMusic\\0002.jpg");
        //返回值:文件在oss中的完整
        String store = fileStorageService.store(prefix, "mv001.jpg", fileInputStream);

        System.out.println(webSite+store);*/
       // fileStorageService.delete("material/2022/7/20220705/mv001.jpg");
    }
}
